﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="NewStudent.aspx.cs" Inherits="NewStudent" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    <h2>Form View</h2>
    <asp:FormView ID="FormView1" runat="server" AllowPaging="True" 
        DataKeyNames="Student_ID" DataSourceID="SqlDataSource1" 
        BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" 
        CellPadding="10" CellSpacing="10" ForeColor="Black" GridLines="Both" 
        Width="280px">
        <EditItemTemplate>
            Student_ID:
            <asp:Label ID="Student_IDLabel1" runat="server" 
                Text='<%# Eval("Student_ID") %>' />
            <br />
            First_Name:
            <asp:TextBox ID="First_NameTextBox" runat="server" 
                Text='<%# Bind("First_Name") %>' />
            <br />
            Last_Name:
            <asp:TextBox ID="Last_NameTextBox" runat="server" 
                Text='<%# Bind("Last_Name") %>' />
            <br />
            GPA:
            <asp:TextBox ID="GPATextBox" runat="server" Text='<%# Bind("GPA") %>' />
            <br />
            Email:
            <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' />
            <br />
            Faculty_ID:
            <asp:TextBox ID="Faculty_IDTextBox" runat="server" 
                Text='<%# Bind("Faculty_ID") %>' />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Update" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </EditItemTemplate>
        <EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <FooterStyle BackColor="#CCCCCC" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <InsertItemTemplate>
            Student_ID:
            <asp:TextBox ID="Student_IDTextBox" runat="server" 
                Text='<%# Bind("Student_ID") %>' />
            <br />
            First_Name:
            <asp:TextBox ID="First_NameTextBox" runat="server" 
                Text='<%# Bind("First_Name") %>' />
            <br />
            Last_Name:
            <asp:TextBox ID="Last_NameTextBox" runat="server" 
                Text='<%# Bind("Last_Name") %>' />
            <br />
            GPA:
            <asp:TextBox ID="GPATextBox" runat="server" Text='<%# Bind("GPA") %>' />
            <br />
            Email:
            <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' />
            <br />
            Faculty_ID:
            <asp:TextBox ID="Faculty_IDTextBox" runat="server" 
                Text='<%# Bind("Faculty_ID") %>' />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insert" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </InsertItemTemplate>
        <ItemTemplate>
            Student_ID:
            <asp:Label ID="Student_IDLabel" runat="server" 
                Text='<%# Eval("Student_ID") %>' />
            <br />
            First_Name:
            <asp:Label ID="First_NameLabel" runat="server" 
                Text='<%# Bind("First_Name") %>' />
            <br />
            Last_Name:
            <asp:Label ID="Last_NameLabel" runat="server" Text='<%# Bind("Last_Name") %>' />
            <br />
            GPA:
            <asp:Label ID="GPALabel" runat="server" Text='<%# Bind("GPA") %>' />
            <br />
            Email:
            <asp:Label ID="EmailLabel" runat="server" Text='<%# Bind("Email") %>' />
            <br />

            Faculty_ID:
            <asp:Label ID="Faculty_IDLabel" runat="server" 
                Text='<%# Bind("Faculty_ID") %>' />
            <br />

        </ItemTemplate>
        <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
        <RowStyle BackColor="White" />
    </asp:FormView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:EC AssignmentConnectionString %>" 
        SelectCommand="SELECT Students.Student_ID,First_Name,Last_Name,GPA,Email,Faculty_ID
FROM Students 
INNER JOIN StudentMembers 
ON Students.Student_ID = StudentMembers.Student_ID"></asp:SqlDataSource>
    <br />
    <h2>ObjectData Source Insert</h2>
    <p>
    <table>
       <tr>
        
            <td><asp:Label ID="Label1" runat="server" Text="ID Number"></asp:Label></td>
            <td><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
       </tr>
       <tr>  
       
            <td><asp:Label ID="Label2" runat="server" Text="First Name"></asp:Label></td>
            <td><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></td>
        </tr>
       
        <tr>
       
            <td><asp:Label ID="Label3" runat="server" Text="Last Name"></asp:Label></td>
            <td><asp:TextBox ID="TextBox3" runat="server"></asp:TextBox></td>
        </tr>
       
        <tr>
            <td><asp:Label ID="Label4" runat="server" Text="GPA"></asp:Label></td>
            <td><asp:TextBox ID="TextBox4" runat="server"></asp:TextBox></td>
       </tr>
       <tr>
        
        <td><asp:Label ID="Label5" runat="server" Text="Email"></asp:Label></td>
        <td><asp:TextBox ID="TextBox5" runat="server"></asp:TextBox></td>
       </tr>
        
        <tr>
        <td><asp:Label ID="Label6" runat="server" Text="Faculty ID"></asp:Label></td>
        <td><asp:TextBox ID="TextBox6" runat="server"></asp:TextBox></td>
       </tr>
    </table>
    </p>
    <p>
       
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" />
    <asp:Button ID="ReturnBtn" runat="server" onclick="ReturnBtn_Click" 
        Text="Return" />
        &nbsp;</p>

    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        InsertMethod="InsertStudent" OldValuesParameterFormatString="original_{0}" 
        SelectMethod="GetStudents" TypeName="StudentDataSource">
        <InsertParameters>
            <asp:Parameter Name="id" Type="Int32" />
            <asp:Parameter Name="fname" Type="String" />
            <asp:Parameter Name="lname" Type="String" />
            <asp:Parameter Name="gpa" Type="Single" />
            <asp:Parameter Name="email" Type="String" />
            <asp:Parameter Name="Faculty_id" Type="Int32" />
            <asp:Parameter Name="Student_ID" Type="Int32" />
            <asp:Parameter Name="First_Name" Type="String" />
            <asp:Parameter Name="Last_Name" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
    <br />
    <br />
    <br />
    </form>
</body>
</html>
